<?php

namespace addons\yunfood\controller;

use addons\yunfood\library\Super;
use addons\yunfood\model\Payment;

/**
 * 订单接口
 */
class Pay extends BaseApi
{
    // 获取支付状态
    public function getPayState()
    {
        $paymentNo = $this->request->post('payment_no');
        if (! $payment = Payment::get(['payment_no' => $paymentNo])) {
            $this->error('支付信息不存在');
        }

        $result = Super::arrayGetSet($payment, [
            'payment_no',
            'amount',
            'status',
            'status_text',
            'request_time',
            'finish_time',
        ]);

        $this->success('success', $result);
    }
}
